package com.sh.mytool.cv.service.impl;

import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.sh.mytool.cv.dao.BasicDao;
import com.sh.mytool.cv.domain.Article;
import com.sh.mytool.cv.service.ArticleService;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@Service("articleService")
public class ArticleServiceImpl implements ArticleService {

    @Resource(name="basicDao")
    private BasicDao<Article> dao;

    @Override
    public Article get(Long id) {
        return dao.findById(Article.class, id);
    }

    @Override
    @Transactional(propagation=Propagation.REQUIRED)
    public void update(Article bean) throws Exception {
        Article orgBean = this.get(bean.getId());
        orgBean.setContent(bean.getContent());
        dao.update(orgBean);
    }

}
